import React from 'react';
import { Table, Icon } from 'antd';
import type { TableProps } from 'antd';
import Smodal from './sModal'
interface DataType {
  key: string;
  name: string;
  age: number;
  address: string;
  tags: string[];
}



const LeftTable: React.FC = () =>{
  let ChildRef = React.createRef();
  const clickB = () => {
    ChildRef.current.showModal()
  }

  const columns: TableProps<DataType>['columns'] = [
    {
      title: '行号',
      dataIndex: 'name',
      key: 'name',
      render: (text) => <a>{text}</a>,
    },
    {
      title: '检验仪器',
      key: 'no',
    },
    {
      title: '姓名',
      ellipsis: true,
      key: 'updateTime',
    },
    {
      title: '实验号',
      ellipsis: true,
      key: 'adminName',
    },
    {
      title: '检验时间',
      ellipsis: true,
      key: 'contractType',
    },
    {
      title: '病人类型',
      ellipsis: true,
      key: 'status',
    },
    {
      title: '样本状态',
      ellipsis: true,
      key: 'age',
    },
    {
      title: '性别',
      ellipsis: true,
      key: 'number',
    },
    {
      align: 'left',
      fixed: 'right',
      key: 'op',
      title: <div style={{display: 'flex',justifyContent: 'space-between'}}><div>操作</div><div style={{border: '1px solid red',cursor: 'pointer'}} onClick={clickB}>按钮</div></div>,
      filterIcon: () => <Icon type="setting" theme="filled" />,
      render: () => {
        return <div style={{display: 'flex'}}>
          <a style={{textDecoration: 'underline'}}>预览</a>
          <a style={{marginLeft: '6px',textDecoration: 'underline'}}>打印</a>
          <a style={{marginLeft: '6px',textDecoration: 'underline'}}>病例</a>
        </div>;
      }
    },
  ];

  const data: DataType[] = [
    {
      key: '1',
      name: '张三',
      age: 32,
      address: 'New York No. 1 Lake Park',
      tags: ['nice', 'developer'],
    },
  ];

  return(<><Table<DataType> columns={columns} dataSource={data} scroll={{ x: 'max-content' }}/>
    <Smodal onRef={ChildRef} data={columns} />
  </>)
}

export default LeftTable;
